<div>
    <div style="float: left;margin-top: 50px;">
        <div class="hd">
            <h3>中学经历</h3>

            <div class="dashed"></div>
        </div>
        <div class="bd">
            <ul class=" js_left_list" id="group_list">
                <volist name="mschool" id="vo">
                    <li rel="-2" id="group__2" class="grouplist1" style="float: left">
                        <div style="width: 700px; margin-top: 10px;">
                            <div style="float: left;">
                                <div class="txt_schoolname">{$vo.school_name} {$vo.entrance_year} {$vo.stype}</div>
                            </div>
                            <div style="float: right">
                                <a id="edit{$vo.id}" onclick="mshowediv('{$vo.id}')" class="act-edit a "
                                   style=" ">编辑</a>
                                <a id="del{$vo.id}" onclick="delcollege('{$vo.id}')" class="act-edit a "
                                   style=" ">删除</a>
                            </div>
                        </div>
                    </li>
                </volist>
            </ul>
        </div>
        <div class="clearfix"></div>
        <div style="margin-top: 20px;float: left">
            <div onclick="mshowdiv()" id="creat_mschool" class="btn_creat placeholder"><span
                    class="xpy-icon je-ico-add"></span>添加中学经历
            </div>


            <div style="background: #f2f6f9;width: 600px;">


                <div class="group-action group-edit"
                     id="creat_mschool_div" style="display: none;width: 700px;padding: 20px 12px 50px 75px;">

                    <div style="">
                        <div class="clearfix"></div>
                        <div class="kong">
                            <div class="tt" style="float: left"> 在该校读：</div>
                            <div class="">
                                <label><input name="cmtype" type="radio" value="5" class=""/>高中</label>
                                <label><input name="cmtype" type="radio" value="6" class=""/>中专或技校</label>
                                <label><input name="cmtype" type="radio" value="7" class=""/>初中</label>

                            </div>
                        </div>
                        <div class="kong">
                            <div class="tt" style="float: left">学校名称：</div>
                            <div><input name="mschoolname" id="mschoolname" autocomplete="off" type="text" value=""/>
                            </div>
                        </div>
                        <div class="clearfix"></div>

                        <div class="kong">
                            <div class="tt" style="float: left">入学年份：</div>
                            <select name="myear" id="cmyear">
                                <volist name="myear" id="v2">
                                    <option name="{$v2}">{$v2}</option>
                                </volist>
                            </select>
                        </div>

                    </div>

                    <p class="act" style="margin-top: 10px;">
                        <input onclick="add_mschool()" class="btn_add" type="submit" value="添加"/>
                        <input onclick="mhidediv()" class="btn_add" type="submit" value="取消"/>

                    </p>
                </div>


                <volist name="mschool" id="vo">
                    <div class="group-action group-edit" id="edit_mschool_div{$vo.id}"
                         style="display: none;width: 700px;padding: 20px 12px 50px 75px;">

                        <div style="">
                            <div class="clearfix"></div>
                            <div class="kong">
                                <div class="tt" style="float: left"> 在该校读：</div>
                                <div class="">
                                    <label><input name="mtype{$vo.id}" type="radio" value="5" class=""
                                        <if condition="5 eq $vo['type']">checked="checked"</if>
                                        />高中</label>
                                    <label><input name="mtype{$vo.id}" type="radio" value="6" class=""
                                        <if condition="6 eq $vo['type']">checked="checked"</if>
                                        />中专或技校</label>
                                    <label><input name="mtype{$vo.id}" type="radio" value="7" class=""
                                        <if condition="7 eq $vo['type']">checked="checked"</if>
                                        />初中</label>
                                </div>
                            </div>
                            <div class="kong">
                                <div class="tt" style="float: left">学校名称：</div>
                                <div>
                                    <input name="mschool_name" id="mschool_name" autocomplete="off" type="text"
                                           value="{$vo['school_name']}"/></div>
                            </div>

                            <div class="clearfix"></div>
                            <div class="kong">
                                <div class="tt" style="float: left">入学年份：</div>
                                <select name="myear" id="myear">

                                    <volist name="myear" id="v">
                                        <option name="{$v}"
                                        <if condition="$v eq $vo['entrance_year']">selected="selected"</if>
                                        >{$v}</option>
                                    </volist>
                                </select>
                            </div>


                            <p class="act" style="margin-top: 10px;" >

                                <input onclick="edit_mschool('{$vo.id}')" class="btn_add" type="submit" value="保存"/>
                                <input onclick="mhideeditdiv('{$vo.id}')" class="btn_add" type="submit" value="取消"/>


                            </p>
                        </div>
                    </div>
                </volist>

            </div>
        </div>
    </div>
</div>

<script>
    function edit(gid) {
        $(".grouplist1 .act-edit").hide();
        $(".group-edit").hide();
        document.getElementById('edit' + gid).style.display = " block";
    }
    function mshowdiv() {
        document.getElementById("creat_mschool_div").style.display = " block";
        document.getElementById("creat_mschool").style.display = " none";
    }
    function mhidediv() {
        document.getElementById("creat_mschool_div").style.display = " none";
        document.getElementById("creat_mschool").style.display = " block";
    }
    function mhideeditdiv(id) {
        document.getElementById("edit_mschool_div" + id).style.display = " none";
        document.getElementById("creat_mschool").style.display = " block";
    }

    function mshowediv(id) {
        document.getElementById("edit_mschool_div" + id).style.display = " block";
        document.getElementById("creat_mschool").style.display = " none";
        document.getElementById("creat_mschool_div").style.display = " none";

    }
    function edit_mschool(id) {

        $.post(U("friend/Info/editmschool"), { type: $("input[name='mtype" + id + "']:checked").val(), id: id, education: 'middle', school: $('#mschool_name').val(), old_school: $('#old_school_id').val(), year: $("#myear").val()}, function (data) {
            if (data.status == 1) {
                ui.success('修改成功！')
            }
            $('#mschool_list').load(U("friend/Info/_mschool"));

        }, 'json');
    }
    function add_mschool() {

        $.post(U("friend/Info/addmschool"), { type: $("input[name='cmtype']:checked").val(), education: 'middle', school: $('#mschoolname').val(), year: $("#cmyear").val()}, function (data) {
            if (data.status == 1) {
                ui.success('添加成功！')
            }
            $('#mschool_list').load(U("friend/Info/_mschool"));

        }, 'json');
    }
    function delcollege(id) {
        $.post(U("friend/Info/delcollege"), { id: id}, function (data) {
            if (data.status == 1) {
                ui.success('删除成功！')
            }
            location.reload()
        }, 'json');
    }
</script>

<script>
    $('#btn_school').click(function () {
        mybox = ui.box.show($('#school_box').html(), '选择学校', function () {
        });
        $('.boxy-modal-blackout').css({position: 'fixed'});
    });
    function load_school(pid) {
        $('#school').load("{:U('friend/Info/_school')}", {pid: pid});
    }
    function set_school(sid, sname) {
        ui.box.close();
        $('#school_id').val(sid);
        $('#show_school').text(sname);
    }

    $('#btn_school1').click(function () {
        mybox = ui.box.show($('#school_box1').html(), '选择学校', function () {
        });
        $('.boxy-modal-blackout').css({position: 'fixed'});
    });
    function load_school1(pid) {
        $('#school1').load("{:U('friend/Info/_school1')}", {pid: pid});
    }
    function set_school1(sid, sname) {
        ui.box.close();
        $('#school_id1').val(sid);
        $('#show_school1').text(sname);
    }
</script>

<style>

</style>